﻿using System;
using System.Linq;
using Bootstrap.Models;
using Bootstrap.Services;

namespace Bootstrap.Features {
	public class {{ClassName}} : IBootstrapFeature, IBootstrapDefaults {
		public void Describe(FeatureDescriptionContext context) {
			context
				.Describe(
					"{{ClassName}}",
					feature =>
					feature
						.IsType("{{#Import}}Import{{/Import}}{{^Import}}Insert{{/Import}}")
						{{#Required}}
						.IsRequired()
						{{/Required}}
						.WithDisplayName("{{FeatureName}}")
						.WithCategory(FeatureCategories.{{Category}}, {{Priority}})
						.WithAction(
							cntxt => 
								{{#Import}}
								new[] {"{{FileName}}.less"}
								{{/Import}}
								{{^Import}}
								cntxt
									.AvailableVariables()
									.Select(
										variable => 
											String.Format("@{0}:{1};\n", variable.Key, variable.Value)
									).ToArray()
								{{/Import}}
							)
				);
		}

		public int Priority {
	        get { return 0; }
	    }

		public void Define(BootstrapDefaultSettingsContext context) {
			context.Feature("{{ClassName}}", feature => feature.Enabled().Position({{Position}}){{#Required}}.Required(){{/Required}});
		}
	}
}